WPS Office.apk(点击下载) / PaperCheckDialog.java


package cn.wps.moffice.main.papercheck.impl;

import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.PorterDuff;
import android.net.Uri;
import android.text.TextUtils;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.AdapterView;
import android.widget.FrameLayout;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.TextView;
import cn.wps.moffice.OfficeApp;
import cn.wps.moffice.common.beans.CommonErrorPage;
import cn.wps.moffice.main.common.viewcontrols.ViewTitleBar;
import cn.wps.moffice_eng.R;
import com.google.firebase.analytics.FirebaseAnalytics;
import com.google.gson.reflect.TypeToken;
import defpackage.czq;
import defpackage.gyb;
import defpackage.gyc;
import defpackage.kia;
import java.io.File;
import java.io.IOException;
import java.math.BigDecimal;
import java.text.NumberFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
import java.util.Comparator;
import java.util.EnumSet;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import org.json.JSONException;
import org.json.JSONObject;

public class PaperCheckDialog extends czq.a implements View.OnClickListener, gxt {
    private Runnable cIl;
    private TextView diM;
    private long djg = System.currentTimeMillis();
    private int dmt;
    private boolean hIQ;
    private boolean hIR;
    gxv hIS;
    private Runnable hIT = new Runnable() {
        /* class cn.wps.moffice.main.papercheck.impl.PaperCheckDialog.AnonymousClass1 */

        public final void run() {
            PaperCheckDialog paperCheckDialog = PaperCheckDialog.this;
            if (paperCheckDialog.isShowing()) {
                gyb.a(paperCheckDialog.hIS, new gyb.a<gxv>() {
                    /* class cn.wps.moffice.main.papercheck.impl.PaperCheckDialog.AnonymousClass3 */

                    /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
                    @Override // defpackage.gyb.a
                    public final /* synthetic */ void Q(gxv gxv) {
                        gxv gxv2 = gxv;
                        if (PaperCheckDialog.this.isShowing()) {
                            switch (gxv2.hIx) {
                                case -1:
                                    PaperCheckDialog.j(PaperCheckDialog.this);
                                    return;
                                case 0:
                                default:
                                    fzc.bJM().c(PaperCheckDialog.this.hIT, 1000);
                                    return;
                                case 1:
                                    dwp.lU("public_apps_papercheck_complete");
                                    PaperCheckDialog.this.b(gxv2);
                                    return;
                                case 2:
                                    PaperCheckDialog.b(PaperCheckDialog.this, gxv2);
                                    return;
                                case 3:
                                    PaperCheckDialog.b(PaperCheckDialog.this, gxv2);
                                    return;
                            }
                        }
                    }
                });
            }
        }
    };
    private CheckItemView hIU;
    private CheckItemView hIV;
    private CheckItemView hIW;
    private CheckItemView hIX;
    private CheckItemView hIY;
    private FrameLayout hIZ;
    private FrameLayout hJa;
    private Runnable hJb = new Runnable() {
        /* class cn.wps.moffice.main.papercheck.impl.PaperCheckDialog.AnonymousClass10 */

        public final void run() {
            if (PaperCheckDialog.this.hIS.hIz.length() > 15728640) {
                dwp.at("public_apps_paperverify_failure", "filesize error");
                gyc.a(PaperCheckDialog.this.mActivity, PaperCheckDialog.this.mActivity.getString(R.string.paper_check_verify_file_oversize), PaperCheckDialog.this);
                return;
            }
            PaperCheckDialog.this.hIV.setFinished();
            fzc.bJM().c(PaperCheckDialog.this.hJc, 1000);
        }
    };
    private Runnable hJc = new Runnable() {
        /* class cn.wps.moffice.main.papercheck.impl.PaperCheckDialog.AnonymousClass11 */

        public final void run() {
            String IS = lwv.IS(PaperCheckDialog.this.hIS.hIz.getName());
            if (TextUtils.isEmpty(IS)) {
                gyc.a(PaperCheckDialog.this.mActivity, PaperCheckDialog.this.mActivity.getString(R.string.paper_check_verify_empty_title), PaperCheckDialog.this);
            } else if (IS.length() > 30) {
                dwp.at("public_apps_paperverify_failure", "title error");
                gyc.a(PaperCheckDialog.this.mActivity, PaperCheckDialog.this.mActivity.getString(R.string.paper_check_verify_title_too_long), PaperCheckDialog.this);
            } else {
                PaperCheckDialog.this.hIS.title = IS;
                PaperCheckDialog.this.hIW.setFinished();
                fzc.bJM().c(PaperCheckDialog.this.hJd, 1000);
            }
        }
    };
    private Runnable hJd = new Runnable() {
        /* class cn.wps.moffice.main.papercheck.impl.PaperCheckDialog.AnonymousClass12 */

        public final void run() {
            if (PaperCheckDialog.this.cIl != null) {
                PaperCheckDialog.this.cIl.run();
            }
        }
    };
    private Runnable hJe = new Runnable() {
        /* class cn.wps.moffice.main.papercheck.impl.PaperCheckDialog.AnonymousClass5 */

        public final void run() {
            PaperCheckDialog.m(PaperCheckDialog.this);
        }
    };
    private Runnable hpy;
    private Activity mActivity;
    private View mRootView;
    private ViewTitleBar mTitleBar;

    public PaperCheckDialog(Activity activity) {
        super(activity, R.style.Dialog_Fullscreen_StatusBar_push_animations);
        this.mActivity = activity;
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void a(ListView listView, View view, View view2, gya gya) {
        this.hJa.setVisibility(8);
        gya.hJq = this.hIS.hIy;
        gya.notifyDataSetChanged();
        if (gya.getCount() == 0) {
            view.setVisibility(0);
            listView.setVisibility(4);
            view2.setVisibility(8);
            return;
        }
        view.setVisibility(8);
        listView.setVisibility(0);
        view2.setVisibility(0);
    }

    static /* synthetic */ void b(PaperCheckDialog paperCheckDialog, gxv gxv) {
        if (paperCheckDialog.isShowing()) {
            paperCheckDialog.dmt = 3;
            paperCheckDialog.hIZ.removeAllViews();
            paperCheckDialog.hIS.hIy = null;
            LayoutInflater.from(paperCheckDialog.mActivity).inflate(R.layout.public_phone_paper_check_checking_layout, paperCheckDialog.hIZ);
            paperCheckDialog.diM.setText(R.string.paper_check_verifying_title);
            TextView textView = (TextView) paperCheckDialog.mRootView.findViewById(R.id.text_checking);
            paperCheckDialog.mRootView.findViewById(R.id.checking_history).setOnClickListener(paperCheckDialog);
            Calendar instance = Calendar.getInstance();
            instance.setTimeInMillis(gxv.hIu * 1000);
            Calendar instance2 = Calendar.getInstance();
            instance2.setTimeInMillis(System.currentTimeMillis());
            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("HH点mm分", Locale.CHINA);
            if (instance2.get(5) < instance.get(5)) {
                textView.setText(paperCheckDialog.mActivity.getString(R.string.paper_check_checking_predict_tomorrow, new Object[]{simpleDateFormat.format(instance.getTime())}));
            } else if (instance2.get(5) == instance.get(5)) {
                textView.setText(paperCheckDialog.mActivity.getString(R.string.paper_check_checking_predict, new Object[]{simpleDateFormat.format(instance.getTime())}));
            }
            if (paperCheckDialog.hIT != null) {
                long currentTimeMillis = (gxv.hIu * 1000) - System.currentTimeMillis();
                if (currentTimeMillis < 30000) {
                    currentTimeMillis = 30000;
                }
                fzc.bJM().c(paperCheckDialog.hIT, currentTimeMillis);
            }
        }
    }

    private void initView() {
        this.mRootView = LayoutInflater.from(this.mActivity).inflate(R.layout.public_phone_paper_check_main_layout, (ViewGroup) null);
        Window window = getWindow();
        this.hIZ = (FrameLayout) this.mRootView.findViewById(R.id.container);
        this.mTitleBar = (ViewTitleBar) this.mRootView.findViewById(R.id.title_bar);
        this.mTitleBar.setTitleText(R.string.paper_check_verify);
        this.mTitleBar.setGrayStyle(window);
        this.mTitleBar.setIsNeedMultiDocBtn(false);
        this.mTitleBar.gBO.setOnClickListener(this);
        this.diM = this.mTitleBar.qN;
        this.hJa = (FrameLayout) this.mRootView.findViewById(R.id.circle_progressBar);
        if (window != null) {
            window.setSoftInputMode(32);
        }
        disableCollectDialogForPadPhone();
        setContentView(this.mRootView);
        if (!isShowing()) {
            show();
        }
    }

    static /* synthetic */ void j(PaperCheckDialog paperCheckDialog) {
        if (paperCheckDialog.isShowing()) {
            paperCheckDialog.dmt = 4;
            paperCheckDialog.hIZ.removeAllViews();
            LayoutInflater.from(paperCheckDialog.mActivity).inflate(R.layout.public_phone_paper_check_failed_layout, paperCheckDialog.hIZ);
            paperCheckDialog.diM.setText(R.string.paper_check_result_title);
            paperCheckDialog.mRootView.findViewById(R.id.contact_custom_service).setOnClickListener(paperCheckDialog);
        }
    }

    static /* synthetic */ void m(PaperCheckDialog paperCheckDialog) {
        if (paperCheckDialog.isShowing()) {
            gyc.a(paperCheckDialog.mActivity, paperCheckDialog, new gyc.a() {
                /* class cn.wps.moffice.main.papercheck.impl.PaperCheckDialog.AnonymousClass6 */

                @Override // defpackage.gyc.a
                public final void yb(String str) {
                    PaperCheckDialog.this.hIY.setFinished();
                    PaperCheckDialog.this.hIS.author = str;
                    PaperCheckDialog.this.a(PaperCheckDialog.this.hIS);
                }
            });
        }
    }

    public final void a(gxv gxv) {
        if (isShowing()) {
            this.dmt = 2;
            this.hIS.hIy = null;
            dwp.lU("public_apps_papercheck_show");
            this.hIZ.removeAllViews();
            LayoutInflater.from(this.mActivity).inflate(R.layout.public_phone_paper_check_begin_check_layout, this.hIZ);
            this.mRootView.findViewById(R.id.check_info).setOnClickListener(this);
            View findViewById = this.mRootView.findViewById(R.id.start_check);
            findViewById.getBackground().setColorFilter(-13200651, PorterDuff.Mode.SRC_IN);
            findViewById.setOnClickListener(this);
            this.diM.setText(R.string.paper_check_verify_doc);
            ((TextView) this.mRootView.findViewById(R.id.paper_title)).setText(gxv.title);
            ((TextView) this.mRootView.findViewById(R.id.paper_check_author)).setText(gxv.author);
            ((TextView) this.mRootView.findViewById(R.id.paper_check_char_num)).setText(this.mActivity.getString(R.string.paper_check_char_count, new Object[]{gxv.hIr}));
            this.hJa.setVisibility(0);
            new fcv<Void, Void, ArrayList<gxz>>(new gyb.a<ArrayList<gxz>>() {
                /* class cn.wps.moffice.main.papercheck.impl.PaperCheckDialog.AnonymousClass13 */

                /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
                @Override // defpackage.gyb.a
                public final /* synthetic */ void Q(ArrayList<gxz> arrayList) {
                    final ArrayList<gxz> arrayList2 = arrayList;
                    PaperCheckDialog.this.hJa.setVisibility(8);
                    if (arrayList2 != null && arrayList2.size() > 0) {
                        PaperCheckDialog.this.hIZ.findViewById(R.id.select_engine_layout).setVisibility(0);
                        final SelectEngineView selectEngineView = (SelectEngineView) PaperCheckDialog.this.hIZ.findViewById(R.id.engine_left);
                        final SelectEngineView selectEngineView2 = (SelectEngineView) PaperCheckDialog.this.hIZ.findViewById(R.id.engine_right);
                        if (arrayList2.size() == 1) {
                            PaperCheckDialog.this.hIS.hIC = arrayList2.get(0);
                            selectEngineView.setDate(arrayList2.get(0));
                            selectEngineView.setSelected(true);
                        } else if (arrayList2.size() == 2) {
                            selectEngineView.setDate(arrayList2.get(0));
                            selectEngineView2.setDate(arrayList2.get(1));
                            if (arrayList2.get(1).hIq.equalsIgnoreCase(gxx.getDefaultEngine())) {
                                PaperCheckDialog.this.hIS.hIC = arrayList2.get(1);
                                selectEngineView.setSelected(false);
                                selectEngineView2.setSelected(true);
                            } else {
                                PaperCheckDialog.this.hIS.hIC = arrayList2.get(0);
                                selectEngineView.setSelected(true);
                                selectEngineView2.setSelected(false);
                            }
                            selectEngineView.setOnClickListener(new View.OnClickListener() {
                                /* class cn.wps.moffice.main.papercheck.impl.PaperCheckDialog.AnonymousClass13.AnonymousClass1 */

                                public final void onClick(View view) {
                                    PaperCheckDialog.this.hIS.hIC = (gxz) arrayList2.get(0);
                                    selectEngineView.setSelected(true);
                                    selectEngineView2.setSelected(false);
                                }
                            });
                            selectEngineView2.setOnClickListener(new View.OnClickListener() {
                                /* class cn.wps.moffice.main.papercheck.impl.PaperCheckDialog.AnonymousClass13.AnonymousClass2 */

                                public final void onClick(View view) {
                                    PaperCheckDialog.this.hIS.hIC = (gxz) arrayList2.get(1);
                                    selectEngineView.setSelected(false);
                                    selectEngineView2.setSelected(true);
                                }
                            });
                        }
                    }
                }
            }) {
                /* class defpackage.gyb.AnonymousClass1 */
                final /* synthetic */ a hJx;

                {
                    this.hJx = r1;
                }

                private ArrayList<gxz> bMt() {
                    try {
                        return (ArrayList) lvb.b(lwd.f("https://papercheck.wps.cn/static/v2/engines_android.json", gyb.bWt()), new TypeToken<List<gxz>>() {
                            /* class defpackage.gyb.AnonymousClass1.AnonymousClass1 */
                        }.getType());
                    } catch (IOException e) {
                        e.printStackTrace();
                        return null;
                    }
                }

                /* Return type fixed from 'java.lang.Object' to match base method */
                /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object[]] */
                /* access modifiers changed from: protected */
                @Override // defpackage.fcv
                public final /* synthetic */ ArrayList<gxz> doInBackground(Void[] voidArr) {
                    return bMt();
                }

                /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
                /* access modifiers changed from: protected */
                @Override // defpackage.fcv
                public final /* synthetic */ void onPostExecute(ArrayList<gxz> arrayList) {
                    ArrayList<gxz> arrayList2 = arrayList;
                    if (this.hJx != null) {
                        this.hJx.Q(arrayList2);
                    }
                }
            }.execute(new Void[0]);
        }
    }

    @Override // defpackage.gxt
    public final void a(gxv gxv, Runnable runnable, Runnable runnable2) {
        this.hIS = gxv;
        this.cIl = runnable;
        this.hpy = runnable2;
        this.dmt = 1;
        dwp.lU("public_apps_paperverify_show");
        initView();
        this.hIZ.removeAllViews();
        LayoutInflater.from(this.mActivity).inflate(R.layout.public_phone_paper_check_verify_layout, this.hIZ);
        this.hIU = (CheckItemView) this.mRootView.findViewById(R.id.item_check_format);
        this.hIV = (CheckItemView) this.mRootView.findViewById(R.id.item_check_size);
        this.hIW = (CheckItemView) this.mRootView.findViewById(R.id.item_check_title);
        this.hIX = (CheckItemView) this.mRootView.findViewById(R.id.item_check_char);
        this.hIY = (CheckItemView) this.mRootView.findViewById(R.id.item_check_auth);
        this.hIU.setTitle(R.string.paper_check_verify_format);
        this.hIV.setTitle(R.string.paper_check_verify_size);
        this.hIW.setTitle(R.string.paper_check_verify_title);
        this.hIX.setTitle(R.string.paper_check_verify_char);
        this.hIY.setTitle(R.string.paper_check_verify_auth);
        if (!this.hIS.hIB) {
            dwp.at("public_apps_paperverify_failure", "type error");
            gyc.a(this.mActivity, this.mActivity.getString(R.string.paper_check_verify_wrong_format), this);
            return;
        }
        this.hIU.setFinished();
        fzc.bJM().c(this.hJb, 1000);
    }

    @Override // defpackage.gxt
    public final void a(File file, gxv gxv) {
        boolean z;
        if (isShowing()) {
            if (this.hIS.hIA < 1000) {
                dwp.at("public_apps_paperverify_failure", "words error");
                gyc.a(this.mActivity, this.mActivity.getString(R.string.paper_check_verify_char_too_less, new Object[]{"1000"}), this);
            } else if (this.hIS.hIA > 100000) {
                dwp.at("public_apps_paperverify_failure", "words error");
                gyc.a(this.mActivity, this.mActivity.getString(R.string.paper_check_verify_char_too_much, new Object[]{100000}), this);
            } else if (!gyb.b(file, gxv)) {
                dwp.at("public_apps_paperverify_failure", "network error");
                gyc.a(this.mActivity, this.mActivity.getString(R.string.paper_check_network_error), this);
            } else {
                if (gxv == null || TextUtils.isEmpty(gxv.hIo) || TextUtils.isEmpty(gxv.hIn)) {
                    z = false;
                } else {
                    boolean b = gyb.b(gxv.hIo, file);
                    boolean b2 = gyb.b(gxv.hIn, gxv.hIz);
                    gxw.bWm();
                    z = b && b2;
                }
                if (!z) {
                    dwp.at("public_apps_paperverify_failure", "network error");
                    gyc.a(this.mActivity, this.mActivity.getString(R.string.paper_check_network_error), this);
                    return;
                }
                gyb.c(gxv);
                try {
                    int parseInt = Integer.parseInt(gxv.hIr);
                    if (parseInt < 1000) {
                        dwp.at("public_apps_paperverify_failure", "words error");
                        gyc.a(this.mActivity, this.mActivity.getString(R.string.paper_check_verify_char_too_less, new Object[]{"1000"}), this);
                    } else if (parseInt > 100000) {
                        dwp.at("public_apps_paperverify_failure", "words error");
                        gyc.a(this.mActivity, this.mActivity.getString(R.string.paper_check_verify_char_too_much, new Object[]{100000}), this);
                    } else {
                        fzc.bJM().y(new Runnable() {
                            /* class cn.wps.moffice.main.papercheck.impl.PaperCheckDialog.AnonymousClass4 */

                            public final void run() {
                                PaperCheckDialog.this.hIX.setFinished();
                                PaperCheckDialog.this.hJa.setVisibility(8);
                            }
                        });
                        fzc.bJM().c(this.hJe, 1000);
                    }
                } catch (NumberFormatException e) {
                    dwp.at("public_apps_paperverify_failure", "network error");
                    gyc.a(this.mActivity, this.mActivity.getString(R.string.paper_check_network_error), this);
                }
            }
        }
    }

    public final void b(gxv gxv) {
        if (isShowing()) {
            lvw.d(getWindow(), false);
            this.dmt = 5;
            this.mRootView.findViewById(R.id.title_bar).setVisibility(8);
            this.hIZ.removeAllViews();
            LayoutInflater.from(this.mActivity).inflate(R.layout.public_paper_check_result_layout, this.hIZ);
            lvw.cm(this.mRootView.findViewById(R.id.title));
            this.hIZ.findViewById(R.id.multi_btn_layout).setVisibility(0);
            this.mRootView.findViewById(R.id.output_detail_report).setOnClickListener(this);
            this.mRootView.findViewById(R.id.check_simple_report).setOnClickListener(this);
            this.mRootView.findViewById(R.id.btn_close).setOnClickListener(this);
            TextView textView = (TextView) this.mRootView.findViewById(R.id.char_count);
            TextView textView2 = (TextView) this.mRootView.findViewById(R.id.repeat_count);
            TextView textView3 = (TextView) this.mRootView.findViewById(R.id.repeat_rate);
            ((TextView) this.mRootView.findViewById(R.id.title_text)).setText(gxv.title);
            ((TextView) this.mRootView.findViewById(R.id.author_text)).setText(gxv.author);
            if (gxv.hIw <= 0) {
                View findViewById = this.mRootView.findViewById(R.id.repeat_count_layout);
                View findViewById2 = this.mRootView.findViewById(R.id.div_line);
                findViewById.setVisibility(8);
                findViewById2.setVisibility(8);
            } else {
                textView2.setText(String.valueOf(gxv.hIw));
            }
            textView.setText(gxv.hIr);
            NumberFormat percentInstance = NumberFormat.getPercentInstance();
            percentInstance.setMaximumFractionDigits(2);
            textView3.setText(percentInstance.format(gxv.hIv));
        }
    }

    @Override // defpackage.gxt
    public final void bWl() {
        this.dmt = 6;
        this.hIQ = true;
        if (this.mRootView == null) {
            initView();
        } else {
            lvw.d(getWindow(), true);
        }
        fzc.bJM().z(this.hIT);
        this.hIZ.removeAllViews();
        LayoutInflater.from(this.mActivity).inflate(R.layout.public_phone_paper_check_history_layout, this.hIZ);
        this.diM.setText(R.string.paper_check_verify_history);
        final CommonErrorPage commonErrorPage = (CommonErrorPage) this.mRootView.findViewById(R.id.network_error_layout);
        final CommonErrorPage commonErrorPage2 = (CommonErrorPage) this.mRootView.findViewById(R.id.empty_tips);
        commonErrorPage2.a(this);
        final ListView listView = (ListView) this.mRootView.findViewById(R.id.history_list);
        commonErrorPage.a(new View.OnClickListener() {
            /* class cn.wps.moffice.main.papercheck.impl.PaperCheckDialog.AnonymousClass7 */

            public final void onClick(View view) {
                commonErrorPage.setVisibility(8);
                PaperCheckDialog.this.bWl();
            }
        }).setVisibility(8);
        if (!lwd.hu(this.mActivity)) {
            commonErrorPage.setVisibility(0);
            commonErrorPage2.setVisibility(8);
            listView.setVisibility(4);
            return;
        }
        this.mTitleBar.setVisibility(0);
        this.hJa.setVisibility(0);
        final gya gya = new gya();
        final View inflate = LayoutInflater.from(this.mActivity).inflate(R.layout.public_phone_paper_check_history_footer_layout, (ViewGroup) listView, false);
        inflate.findViewById(R.id.contact_custom_service).setOnClickListener(this);
        inflate.findViewById(R.id.take_lesson).setOnClickListener(this);
        listView.addFooterView(inflate, null, false);
        listView.setAdapter((ListAdapter) gya);
        listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            /* class cn.wps.moffice.main.papercheck.impl.PaperCheckDialog.AnonymousClass8 */

            @Override // android.widget.AdapterView.OnItemClickListener
            public final void onItemClick(AdapterView<?> adapterView, View view, int i, long j) {
                gxv gxv = (gxv) listView.getItemAtPosition(i);
                gxv.hIy = PaperCheckDialog.this.hIS.hIy;
                PaperCheckDialog.this.hIS = gxv;
                switch (gxv.hIx) {
                    case -1:
                        return;
                    case 0:
                    default:
                        PaperCheckDialog.this.a(gxv);
                        PaperCheckDialog.this.bWs();
                        return;
                    case 1:
                        gyb.a(gxv, new gyb.a<gxv>() {
                            /* class cn.wps.moffice.main.papercheck.impl.PaperCheckDialog.AnonymousClass8.AnonymousClass1 */

                            /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
                            @Override // defpackage.gyb.a
                            public final /* synthetic */ void Q(gxv gxv) {
                                PaperCheckDialog.this.b(gxv);
                            }
                        });
                        return;
                    case 2:
                        PaperCheckDialog.b(PaperCheckDialog.this, gxv);
                        return;
                    case 3:
                        PaperCheckDialog.b(PaperCheckDialog.this, gxv);
                        return;
                }
            }
        });
        if (this.hIS == null || this.hIS.hIy == null) {
            new fcv<Void, Void, ArrayList<gxv>>(new gyb.a<gxv>() {
                /* class cn.wps.moffice.main.papercheck.impl.PaperCheckDialog.AnonymousClass9 */

                /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
                @Override // defpackage.gyb.a
                public final /* synthetic */ void Q(gxv gxv) {
                    PaperCheckDialog.this.hIS = gxv;
                    PaperCheckDialog.this.a(listView, commonErrorPage2, inflate, gya);
                }
            }) {
                /* class defpackage.gyb.AnonymousClass2 */
                final /* synthetic */ a hJx;

                {
                    this.hJx = r1;
                }

                private ArrayList<gxv> bMt() {
                    try {
                        return (ArrayList) lvb.b(lwd.f("https://papercheck.wps.cn/api/v1/checks", gyb.bWt()), new TypeToken<ArrayList<gxv>>() {
                            /* class defpackage.gyb.AnonymousClass2.AnonymousClass1 */
                        }.getType());
                    } catch (IOException e) {
                        e.printStackTrace();
                        return null;
                    }
                }

                /* Return type fixed from 'java.lang.Object' to match base method */
                /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object[]] */
                /* access modifiers changed from: protected */
                @Override // defpackage.fcv
                public final /* synthetic */ ArrayList<gxv> doInBackground(Void[] voidArr) {
                    return bMt();
                }

                /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
                /* access modifiers changed from: protected */
                @Override // defpackage.fcv
                public final /* synthetic */ void onPostExecute(ArrayList<gxv> arrayList) {
                    ArrayList<gxv> arrayList2 = arrayList;
                    if (this.hJx != null) {
                        if (arrayList2 != null && arrayList2.size() > 0) {
                            Collections.sort(arrayList2, new Comparator<gxv>() {
                                /* class defpackage.gyb.AnonymousClass2.AnonymousClass2 */

                                /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object, java.lang.Object] */
                                @Override // java.util.Comparator
                                public final /* bridge */ /* synthetic */ int compare(gxv gxv, gxv gxv2) {
                                    return (int) (gxv2.create_time - gxv.create_time);
                                }
                            });
                            Iterator<gxv> it = arrayList2.iterator();
                            while (it.hasNext()) {
                                gxv next = it.next();
                                next.hIt = new BigDecimal(next.hIt).setScale(2, 4).toString();
                                if ("checking".equals(next.status)) {
                                    next.hIx = 3;
                                } else if ("transfering".equals(next.status)) {
                                    next.hIx = 2;
                                } else if (FirebaseAnalytics.Param.SUCCESS.equals(next.status)) {
                                    next.hIx = 1;
                                } else if ("failed".equals(next.status)) {
                                    next.hIx = -1;
                                }
                            }
                        }
                        gxv gxv = new gxv();
                        gxv.hIy = arrayList2;
                        this.hJx.Q(gxv);
                    }
                }
            }.execute(new Void[0]);
        } else {
            a(listView, commonErrorPage2, inflate, gya);
        }
    }

    public final void bWs() {
        hun hun = new hun();
        hun.iPC = this.hIS;
        hun.source = "android_vip_papercheck";
        hun.iPH = new hum() {
            /* class cn.wps.moffice.main.papercheck.impl.PaperCheckDialog.AnonymousClass2 */
        };
        crc asU = crc.asU();
        Activity activity = this.mActivity;
        asU.asW();
    }

    @Override // defpackage.czq.a
    public void dismiss() {
        if (this.hIR) {
            lvg.d(this.mActivity, R.string.paper_check_checking_loading, 0);
            return;
        }
        if (this.hpy != null) {
            this.hpy.run();
        }
        fzc.bJM().z(this.hJe);
        fzc.bJM().z(this.hIT);
        fzc.bJM().z(this.hJb);
        fzc.bJM().z(this.hJc);
        fzc.bJM().z(this.hJd);
        this.hIQ = false;
        this.hIT = null;
        super.dismiss();
    }

    @Override // defpackage.gxt
    public final void oI(boolean z) {
        this.hIR = z;
    }

    public void onBackPressed() {
        if ((this.dmt == 5 || this.dmt == 3) && this.hIQ) {
            bWl();
        } else if (this.hIR) {
            lvg.d(this.mActivity, R.string.paper_check_checking_loading, 0);
        } else {
            super.onBackPressed();
            dismiss();
        }
    }

    public void onClick(View view) {
        boolean z;
        long currentTimeMillis = System.currentTimeMillis();
        if (Math.abs(currentTimeMillis - this.djg) < 200) {
            z = false;
        } else {
            this.djg = currentTimeMillis;
            z = true;
        }
        if (z) {
            switch (view.getId()) {
                case R.id.btn_close /*{ENCODED_INT: 2131362163}*/:
                case R.id.titlebar_backbtn /*{ENCODED_INT: 2131368677}*/:
                    onBackPressed();
                    return;
                case R.id.check_info /*{ENCODED_INT: 2131362257}*/:
                    dwp.lU("public_apps_papercheck_knowledge");
                    czq czq = new czq(this.mActivity);
                    czq.setTitle(this.mActivity.getString(R.string.paper_check_paper_start_check_info));
                    czq.setMessage(R.string.paper_check_paper_start_check_info_detail);
                    czq.setPositiveButton(R.string.home_task_know, (DialogInterface.OnClickListener) null);
                    czq.disableCollectDilaogForPadPhone();
                    czq.setCanceledOnTouchOutside(false);
                    czq.setOnKeyListener(new DialogInterface.OnKeyListener() {
                        /* class cn.wps.moffice.main.papercheck.impl.PaperCheckDialog.AnonymousClass14 */

                        public final boolean onKey(DialogInterface dialogInterface, int i, KeyEvent keyEvent) {
                            return 4 == i && keyEvent.getAction() == 1;
                        }
                    });
                    czq.getPositiveButton().setTextColor(-1162898);
                    czq.show();
                    return;
                case R.id.check_simple_report /*{ENCODED_INT: 2131362266}*/:
                    dwp.lU("public_apps_papercheck_report");
                    if ("gocheck".equalsIgnoreCase(this.hIS.hIq) || "daya".equalsIgnoreCase(this.hIS.hIq)) {
                        lvg.d(this.mActivity, R.string.paper_check_engine_nosupport, 0);
                        return;
                    }
                    final czy aM = gyc.aM(this.mActivity);
                    aM.show();
                    gxv gxv = this.hIS;
                    AnonymousClass16 r3 = new gyb.a<gxv>() {
                        /* class cn.wps.moffice.main.papercheck.impl.PaperCheckDialog.AnonymousClass16 */

                        /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
                        @Override // defpackage.gyb.a
                        public final /* synthetic */ void Q(gxv gxv) {
                            gxv gxv2 = gxv;
                            if (TextUtils.isEmpty(gxv2.location)) {
                                aM.axW();
                                lvg.d(PaperCheckDialog.this.mActivity, R.string.documentmanager_qing_roamingdoc_no_network_operation_fail, 0);
                            } else if (gxv2.create_time <= 0 || gxv2.create_time >= 1514527200) {
                                Calendar instance = Calendar.getInstance();
                                instance.setTimeInMillis(gxv2.create_time * 1000);
                                SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMddHHmm", Locale.CHINA);
                                String str = OfficeApp.arx().arM().lZQ + gxv2.id + File.separator + OfficeApp.arx().getString(R.string.paper_check_result_pdf_file_name, new Object[]{gxv2.title, simpleDateFormat.format(instance.getTime())});
                                File file = new File(str);
                                if (!file.exists()) {
                                    PaperCheckDialog paperCheckDialog = PaperCheckDialog.this;
                                    czy czy = aM;
                                    if (file.getParentFile() != null && !file.getParentFile().exists()) {
                                        file.getParentFile().mkdirs();
                                    }
                                    kia.c.meV.b(new khz(gxv2.id.hashCode(), gxv2.location, file.getPath()), new kia.d(czy, file) {
                                        /* class cn.wps.moffice.main.papercheck.impl.PaperCheckDialog.AnonymousClass17 */
                                        final /* synthetic */ File cwi;
                                        final /* synthetic */ czy hJp;

                                        {
                                            this.hJp = r2;
                                            this.cwi = r3;
                                        }

                                        @Override // defpackage.kia.d
                                        public final void a(khz khz) {
                                        }

                                        @Override // defpackage.kia.d
                                        public final void b(khz khz) {
                                        }

                                        @Override // defpackage.kia.d
                                        public final void c(khz khz) {
                                            if (!this.hJp.cPS) {
                                                edk.a((Context) PaperCheckDialog.this.mActivity, this.cwi.getPath(), false, (edn) null, false);
                                            }
                                            this.hJp.axW();
                                        }

                                        @Override // defpackage.kia.d
                                        public final void d(khz khz) {
                                            this.hJp.axW();
                                        }

                                        @Override // defpackage.kia.d
                                        public final void e(khz khz) {
                                        }
                                    });
                                    return;
                                }
                                aM.axW();
                                edk.a((Context) PaperCheckDialog.this.mActivity, str, false, (edn) null, false);
                            } else {
                                aM.axW();
                                if (gxv2.hIq.equals("paperpass")) {
                                    lvg.d(PaperCheckDialog.this.mActivity, R.string.paper_check_result_pp_expire, 0);
                                } else {
                                    lvg.d(PaperCheckDialog.this.mActivity, R.string.documentmanager_qing_roamingdoc_no_network_operation_fail, 0);
                                }
                            }
                        }
                    };
                    if (gxv == null || TextUtils.isEmpty(gxv.id) || TextUtils.isEmpty(gxv.hIp)) {
                        lvg.d(OfficeApp.arx(), R.string.documentmanager_qing_roamingdoc_no_network_operation_fail, 0);
                        return;
                    } else {
                        new fcv<Void, Void, Void>(gxv, r3) {
                            /* class defpackage.gyb.AnonymousClass5 */
                            final /* synthetic */ gxv hJA;
                            final /* synthetic */ a hJx;

                            {
                                this.hJA = r1;
                                this.hJx = r2;
                            }

                            private Void aLj() {
                                try {
                                    JSONObject jSONObject = new JSONObject(lwd.f(String.format("https://papercheck.wps.cn/api/v1/papers/%s/checks/%s/result-pdf-url", this.hJA.id, this.hJA.hIp), gyb.bWt()));
                                    this.hJA.location = jSONObject.optString("location");
                                    return null;
                                } catch (IOException | JSONException e) {
                                    e.printStackTrace();
                                    return null;
                                }
                            }

                            /* Return type fixed from 'java.lang.Object' to match base method */
                            /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object[]] */
                            /* access modifiers changed from: protected */
                            @Override // defpackage.fcv
                            public final /* synthetic */ Void doInBackground(Void[] voidArr) {
                                return aLj();
                            }

                            /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
                            /* access modifiers changed from: protected */
                            @Override // defpackage.fcv
                            public final /* synthetic */ void onPostExecute(Void r3) {
                                this.hJx.Q(this.hJA);
                            }
                        }.execute(new Void[0]);
                        return;
                    }
                case R.id.checking_history /*{ENCODED_INT: 2131362279}*/:
                    fzc.bJM().z(this.hIT);
                    bWl();
                    return;
                case R.id.contact_custom_service /*{ENCODED_INT: 2131362423}*/:
                    try {
                        this.mActivity.startActivity(new Intent("android.intent.action.VIEW", Uri.parse("http://wpa.b.qq.com/cgi/wpa.php?ln=1&key=XzkzODA1NjE4Ml80NzczNjRfNDAwODk4MDcwN18yXw")));
                        return;
                    } catch (ActivityNotFoundException e) {
                        lvg.d(this.mActivity, R.string.home_please_install_qq, 0);
                        return;
                    }
                case R.id.output_detail_report /*{ENCODED_INT: 2131365507}*/:
                    dwp.lU("public_apps_papercheck_report_zip");
                    final czy aM2 = gyc.aM(this.mActivity);
                    gxv gxv2 = this.hIS;
                    AnonymousClass15 r32 = new gyb.a<gxv>() {
                        /* class cn.wps.moffice.main.papercheck.impl.PaperCheckDialog.AnonymousClass15 */

                        /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
                        @Override // defpackage.gyb.a
                        public final /* synthetic */ void Q(gxv gxv) {
                            gxv gxv2 = gxv;
                            aM2.axW();
                            if (TextUtils.isEmpty(gxv2.location)) {
                                lvg.d(PaperCheckDialog.this.mActivity, R.string.documentmanager_qing_roamingdoc_no_network_operation_fail, 0);
                            } else {
                                gyc.w(PaperCheckDialog.this.mActivity, gxv2.location);
                            }
                        }
                    };
                    if (gxv2 == null || TextUtils.isEmpty(gxv2.id) || TextUtils.isEmpty(gxv2.hIp)) {
                        lvg.d(OfficeApp.arx(), R.string.documentmanager_qing_roamingdoc_no_network_operation_fail, 0);
                        return;
                    } else {
                        new fcv<Void, Void, Void>(gxv2, r32) {
                            /* class defpackage.gyb.AnonymousClass4 */
                            final /* synthetic */ gxv hJA;
                            final /* synthetic */ a hJx;

                            {
                                this.hJA = r1;
                                this.hJx = r2;
                            }

                            private Void aLj() {
                                try {
                                    JSONObject jSONObject = new JSONObject(lwd.f(String.format("https://papercheck.wps.cn/api/v1/papers/%s/checks/%s/result-url", this.hJA.id, this.hJA.hIp), gyb.bWt()));
                                    this.hJA.location = jSONObject.optString("location");
                                    return null;
                                } catch (IOException | JSONException e) {
                                    e.printStackTrace();
                                    return null;
                                }
                            }

                            /* Return type fixed from 'java.lang.Object' to match base method */
                            /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object[]] */
                            /* access modifiers changed from: protected */
                            @Override // defpackage.fcv
                            public final /* synthetic */ Void doInBackground(Void[] voidArr) {
                                return aLj();
                            }

                            /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
                            /* access modifiers changed from: protected */
                            @Override // defpackage.fcv
                            public final /* synthetic */ void onPostExecute(Void r3) {
                                this.hJx.Q(this.hJA);
                            }
                        }.execute(new Void[0]);
                        return;
                    }
                case R.id.public_common_error_btn /*{ENCODED_INT: 2131367135}*/:
                    EnumSet of = EnumSet.of(cqd.DOC_FOR_PAPER_CHECK);
                    Intent a = fvf.a(this.mActivity, (EnumSet<cqd>) of, false);
                    if (a != null) {
                        a.putExtra("file_type", of);
                        a.putExtra("guide_type", 12);
                        this.mActivity.startActivityForResult(a, 10000);
                        return;
                    }
                    return;
                case R.id.start_check /*{ENCODED_INT: 2131368346}*/:
                    if (this.hIS.hIC == null) {
                        lvg.d(this.mActivity, R.string.public_msg_network_timeout, 0);
                        return;
                    }
                    dwp.at("public_apps_papercheck_startcheck_click", this.hIS.hIC.hIq);
                    bWs();
                    return;
                case R.id.take_lesson /*{ENCODED_INT: 2131368487}*/:
                    dwp.lU("public_apps_papercheck_historylist_view_tutorial");
                    gyc.aN(this.mActivity);
                    return;
                default:
                    return;
            }
        }
    }
}